<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('功能选择')" />
    <style type="text/css">
    .layui-col-md2{max-width:220px}
    .layui-form-item {margin-bottom: 0px;}
    .layui-form-label {width: 100px;margin-left: -10px;margin-right: -10px;}
    </style>
</head>
<body>
<form>
     <div class="layui-form-item">
     	<div class="layui-inline layui-col-xs5">
          <label class="layui-form-label">功能名称：</label>
          <div class="layui-input-block">
              <input type="text" name="moduleName" id="moduleName" autocomplete="off" placeholder="请输入" class="layui-input">
          </div>
	      </div>
	      <div class="layui-inline layui-col-xs5">
	          <label class="layui-form-label">功能别名：</label>
	          <div class="layui-input-block">
	              <input type="text" name="moduleAlias" id="moduleAlias" autocomplete="off" placeholder="请输入" class="layui-input">
	          </div>
	      </div>
	      <div class="layui-inline layui-col-xs5">
	          <label class="layui-form-label">功能唯一标识：</label>
	          <div class="layui-input-block">
	              <input type="text" name="moduleTable" id="moduleTable" autocomplete="off" placeholder="请输入" class="layui-input">
	          </div>
	      </div>
	      <div class="layui-inline layui-col-xs5" style="margin-left:15px">
	          <a class="layui-btn layuiadmin-btn-order dhicon dh-search" id="btn-search"><span class="fa_span">查询</span></a>
	          <button type="reset" class="layui-btn layui-btn-primary dhicon dh-refresh" id="dh-resets"><span class="fa_span">重置</span></button>
	      </div>
     </div>
</form>
<div style="padding: 0 10px;">
	<div class="layui-inline layui-col-md12">
		<table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + "system/dictionaryformodule";
	/*]]>*/
</script>
<script type="text/javascript">
var $,layer,table,form,laydate,wherestr={};
layui.use(['table','layer','jquery','form','laydate'], function () {
	$ = layui.$,layer = layui.layer,table = layui.table,form = layui.form,laydate=layui.laydate;
    $.tablelist.init({
        elem: '#dhtable'
        ,url: prefix+"/list"
        ,cols: [[
            {type:'numbers', fixed: 'left'}
            ,{type:'radio'}
            ,{field:'moduleTable', title: '功能唯一标识',align: 'center'}
            ,{field:'moduleName', title: '功能名称',align: 'center'}
            ,{field:'moduleAlias', title: '功能别名',align: 'center'}
        ]
        ]
        ,height:315
    });
	table.on('row(ftable)', function(obj){
   		obj.tr.find('input[lay-type="layTableRadio"]').prop("checked",true);
		var index = obj.tr.data('index')
       	var thisData = table.cache.dhtable;	//dhtable 表名
       	//重置数据单选属性
       	layui.each(thisData, function(i, item){
      		if(index === i){
               item.LAY_CHECKED = true;
       	} else {
           	delete item.LAY_CHECKED;
       	}
       	});
       	form.render('radio');
   	});
 	//搜索按钮
 	$('#btn-search').on('click', function () {
        table.reload('dhtable', {page: {curr: 1},where:{moduleName:$("#moduleName").val(),moduleAlias:$("#moduleAlias").val(),moduleTableC:$("#moduleTable").val()}});
     });
});
var callbackdata = function () {
	if(!!table.checkStatus('dhtable').data[0]){
	    return table.checkStatus('dhtable').data[0];
	}else{
		return "none";
	}
}
</script>
</body>
</html>